package com.example.evanproject.config;
import com.example.evanproject.Interceptor.JwtInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        System.out.println("9090");
//       添加拦截的
        registry.addInterceptor(jwtInterceptor())
        .addPathPatterns("/**")
        .excludePathPatterns("/login/*")
        .excludePathPatterns("/lesson/updateviod")
        .excludePathPatterns("/imserver/**")
        .excludePathPatterns("/course/**")
         .excludePathPatterns("/trends/**")
        .excludePathPatterns("/loginadmin/**");
                //允许的请求方式
        super.addInterceptors(registry);
    }

    @Bean
    public HandlerInterceptor jwtInterceptor() {
        return new JwtInterceptor();
    }

}